Skip to content
This repository was archived by the owner on Oct 12, 2026. It is now read-only.

feat: unified type system - #5

Merged
nos1dot618 merged 4 commits into
masterfrom
feat/4-unified-type-system
Sep 30, 2026
Merged

nos1dot618 merged 4 commits into
masterfrom
feat/4-unified-type-system

Conversation

@nos1dot618

Copy link
Copy Markdown
Member

Problem

Lambda-discipline maintains two separate type systems (compile-time and runtime) causing code duplication and type information loss at the compilation boundary.

Solution

Consolidated into a single lbd::types::Type system serving both compile-time and runtime needs with proper lazy evaluation and variadic function support.

Changes

  • Created lbd::types::Type with unified TypeKind enum
  • Replaced old lbd::type::Type and lbd::runtime::type::Type
  • Updated frontend parser, runtime interpreter, and all builtins
  • Added factory methods: Type::named(), Type::function(), Type::applied()
  • Added hardCheck flag for lazy evaluation control
  • Added isVariadic flag for variadic function tracking
  • Applied m_ prefix convention for all private members

Results

  • 25/25 integration tests passing (was 2 passing, 8 failing)
  • Recursive functions, function composition, and lazy evaluation all working
  • Type information flows end-to-end through pipeline
  • No breaking changes to external API

Test Coverage

  • Type annotations (simple, curried, higher-order)
  • Recursion patterns (simple, mutual, deep)
  • Function composition and application
  • List operations and folding
  • Edge cases and regression tests

nos1dot618 and others added 4 commits September 30, 2026 22:26
- Create lbd::types::Type with unified TypeKind enum
- Support all type variants: NAMED, FUNCTION, APPLIED, QUALIFIED, CLOSURE, etc.
- Implement factory methods: Type::named(), Type::function(), Type::applied()
- Add type equality, hashing, and string representation
- Implement runtime type matching with TypeTag optimization
- Remove old duplicate type implementations
- Update frontend parser to use lbd::types::Type
- Update symbol definitions and lambda expressions
- Update NativeFunction to use unified type system
- Update builtin modules (Core, IO, List)
- Replace toString() calls with operator<<
- Update Interpreter for type checking with unified types
- Ensure proper type annotation handling throughout
- Remove include/lbd/type/Type.hpp (replaced by lbd::types::Type)
- Remove include/lbd/type/TypeKind.hpp (merged into TypeKind enum)
- Remove src/type/Type.cpp (implementation moved to lbd::types)

Cleanup of old compile-time type system no longer needed.
Core type system tests:
- type_system: Simple and higher-order function annotations
- polymorphic_functions: Function composition patterns
- curried_functions: Multi-argument curried functions
- mutual_recursion: Mutual recursion (isEven/isOdd)
- nested_applications: Deeply nested function applications
- higher_order_generic: Generic higher-order functions
- list_processing: List operations with map

Edge cases and regression tests:
- edge_cases_numbers: Zero, negative, large numbers
- edge_cases_lists: Single/two element lists
- deep_recursion: Recursive sum computation
- regression_lazy_eval: Lazy evaluation verification
- complex_typing: Multi-level function composition
- variadic_functions: Map and foldRight operations
- any_type_annotations: Any type handling
- list_reduction: FoldRight aggregation

All tests passing: 25/25

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@nos1dot618 nos1dot618 self-assigned this Sep 30, 2026
@nos1dot618
nos1dot618 merged commit 8e27072 into master Sep 30, 2026
6 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant